Compiling Protobuf Files

Generating .java Files

Protoc compiler is used to compile the market_data.proto, order.proto, and utilities.proto files and generate the MarketData.java, Order.java, and Utilities.java files accordingly.

To compile proto files and generate .java (protobuf) files:

  1. Create a folder on your local machine (e.g., C:\EzeEMSxAPI) to copy and paste the files for compilation and store the generated files.

  1. Copy and paste the downloaded Protoc compiler files in the folder you have created in step 1 (e.g., C:\EzeEMSxAPI\protoc-21.1-win64).

  1. Create a sub-folder to store the proto files (e.g., C:\EzeEMSxAPI\Protos).

Note: Contact your SS&C Eze client service representative for latest proto files or download them from GitHub.

  1. Run the following command in command prompt to generate *.java files:

    Copy
    >protoc -I=$SRC_DIR --java_out=$DST_DIR $SRC_DIR\market_data.proto
    • $SRC_DIR — The source path to fetch the proto files

    • $DST_DIR — The destination path for storing the generated files

For example, run the below command to generate the market_data.java file using market_data.proto.

Copy
>protoc -I=C:\EzeEMSxAPI\Protos --java_out=C:\EzeEMSxAPI\Protos C:\EzeEMSxAPI\Protos\market_data.proto

You can generate the .java files for Order and Utilities by replacing market_data.proto with order.proto and then with utilities.proto in the above command. The Order.java and Utilities.java files are generated on running the command.

Generating Service Stub Files

Proto-gen-grpc-java is used to compile the market_data.proto, Order.proto, and Utilities.proto files and generate the MarketDataServiceGrpc.java, SubmitOrderServiceGrpc.java, and UtilityServicesGrpc.java files accordingly.

To compile proto files and generate service stub files:

Run the following command in command prompt to generate the service stub files:

Copy
>protoc --plugin=protoc-gen-grpc-java=%DIR_OF_PROTOC_FILE%\%FILENAME% --grpc-java_out=lite:%OUTPUT_FILE% --proto_path=%DIR_OF_PROTO_FILE% %PROTO_FILE%
  • %DIR_OF_PROTOC_FILE% — The source path to fetch the protoc file

  • %FILENAME% — Name of the protoc file

  • %OUTPUT_FILE% — The destination path for storing the generated files

  • %PROTO_FILE% — Name of the proto file

For example, run the below command to generate the UtilityServicesGrpc.java file using utilities.proto.

Copy
>protoc --plugin=protoc-gen-grpc-java=C:\EzeEMSxAPI\protoc-21.1-win64\bin\protoc-gen-grpc-java-1.47.0-windows-x86_64.exe --grpc-java_out=lite:C:\EzeEMSxAPI\Protos --proto_path=C:\EzeEMSxAPI\Protos Utilities.proto

You can generate the service stub files for Order and Market Data by replacing utilities.proto with order.proto and then with market_data.proto in the above command. The SubmitOrderServiceGrpc.java and MarketDataServiceGrpc.java files are generated on running the command.